<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/22
 * Time: 15:29
 */

namespace app\admin\controller;

use app\model\Express as ModelExpress;

class Express extends Member
{
    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * 快递公司添加
     * uri:/admin/express.add
     */
    public function expressAdd(){
        $express_name = $this->_getContentParams('expressName');
        _toCompare(empty($express_name),'==',true,20014);
        $express_logo = $this->_getContentParams('expressLogo');
        _toCompare(empty($express_logo),'==',true,20015);
        $express_com = $this->_getContentParams('expressCom');
        _toCompare(empty($express_com),'==',true,20016);
        $express_phone = $this->_getContentParams('expressPhone');

        $expressName = ModelExpress::getInstance()->toFind("express_name='$express_name'");
        _toCompare(!empty($expressName),'==',true,20017);
        $expressCom = ModelExpress::getInstance()->toFind("express_com='$express_com'");
        _toCompare(!empty($expressCom),'==',true,20018);
        $arr_where=[
            'express_name'=>$express_name,
            'express_logo'=>$express_logo,
            'express_com'=>$express_com,
            'express_phone'=>$express_phone
        ];
        $data = ModelExpress::getInstance()->toAdd($arr_where);
        if ($data>0){
            _returnData();
        }
    }
}